<? FoundryView::includeTpl( 'adminMain:header' ) ?>

<script type="text/javascript" src="<?=Foundry::config('webpath')?>/javascript/admin/pageRules.js"></script>


<div id="mainContent">

	<h2>Pages</h2>
	
	<a href="<?=FoundryView::helperLinkTo( 'pageAdmin/edit' )?>" class="actionLink">
		<img src="<?=Foundry::config('webpath')?>/images/admin/add.png" />
		new page</a>
	<span id="actionMessage"></span>
	<p />
	
	<?php
		$model = FoundryController::model( 'page' );
		$pages = $model->find( 'order by *modified asc' );		
	?>
		
	<ul class="assetList">
	<? foreach( $pages as $page ) : ?>
	
		<li id="pageContainer<?=$page->uid?>">
			<span class="label">
				<a href="<?=FoundryView::helperLinkTo('pageAdmin/edit')?>/<?=$page->uid?>"><?=$page->title?></a>
			</span>
			<span class="describe">
				Last modified: <?=date( 'd F Y', $page->modified )?>
			</span>
			<span class="icons">
			<img src="<?=Foundry::config('webpath')?>/images/admin/cross.png" title="Delete this page" class="pageDelete" for="<?=$page->uid?>" />
			<? if( $page->published == 1 ) : ?>
				<img src="<?=Foundry::config('webpath')?>/images/admin/star.png" title="Publish this page" />
			<? else: ?>
				<img src="<?=Foundry::config('webpath')?>/images/admin/star_inactive.png" title="Publish this page" class="pagePublish" for="<?=$page->uid?>" id="pagePublishStatus<?=$page->uid?>" />
			<? endif ?>
			<a href="<?=FoundryView::helperLinkTo('page/')?><?=$page->uid?>" target="new" class="iconLink"><img src="<?=Foundry::config('webpath')?>/images/admin/world.png" title="Preview this page" /></a>
			</span>
		</li>
		<li id="infoBumper<?=$page->uid?>" style="display: none"></li>
	
	<? endforeach ?>
	</ul>
	
</div>

<? FoundryView::includeTpl( 'adminMain:footer' ) ?>